home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1997 February: Technology Seed / Mac Tech Seed Feb '97.toast / OpenDoc 1.2b2c1 / Implementation / Utilities / ODProcessUtils.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  1997-02-13  |  1.2 KB  |  50 lines  |  [TEXT/MPS ]

  1. /*
  2.     File:        ODProcessUtils.cpp
  3.  
  4.     Contains:    xxx put contents here xxx
  5.  
  6.     Owned by:    Reggie Adkins
  7.  
  8.     Copyright:    © 1996 by Apple Computer, Inc., all rights reserved.
  9.  
  10.     Change History (most recent first):
  11.  
  12.          <1>     9/17/96    RA        first checked in
  13.  
  14.     To Do:
  15. */
  16.  
  17. #ifndef _ODPROCESSUTILS_
  18. #include "ODProcessUtils.h"
  19. #endif
  20.  
  21. //-------------------------------------------------------------------------------------
  22. // FindFinder
  23. //-------------------------------------------------------------------------------------
  24.  
  25. // Will find the precise process of signature 'sig' and type 'type'
  26.  
  27. OSErr
  28. FindProcess(ProcessSerialNumberPtr aPSN, OSType sig, unsigned long type)
  29. {
  30.     ProcessInfoRec    theProcessInfo;
  31.     FSSpec            theProcessFile;
  32.     Str31            theProcessName;
  33.     OSErr            theError = noErr;
  34.  
  35.     aPSN->lowLongOfPSN = 0;
  36.     aPSN->highLongOfPSN = kNoProcess;
  37.     theProcessInfo.processInfoLength = sizeof(ProcessInfoRec);
  38.     theProcessInfo.processName = theProcessName;
  39.     theProcessInfo.processAppSpec = &theProcessFile;
  40.     do {
  41.         theError = GetNextProcess(aPSN);
  42.         if (theError == noErr) {
  43.             GetProcessInformation(aPSN, &theProcessInfo);
  44.         }
  45.     } while(((theProcessInfo.processSignature != sig) ||
  46.         (theProcessInfo.processType != type)) &&
  47.         (theError == noErr));
  48.     return(theError);
  49. }
  50.